You have to complete a certain number of credit hours to
graduate. Each class you take in a given semester earns you credit
hours. For example, if you take 5 classes during a semester, and
each of those classes counts for 3 credit hours, you earn a total
of 15 credit hours during that semester. So, for example, if your
intended degree requires 120 credit hours of coursework, and you
plan on taking 15 credit hours of classes each semester, then
you're looking at 4 years of studies to get your degree (assuming 2
semesters per year and no summer classes).
The graduation requirements will usually specify how the total
number of credit hours required for the degree have to be
distributed between elective and core courses.
If your plan is to enroll in a community college and subsequently
transfer to a 4-year college, you might want to check ahead with
the 4-year college to find out which CCs they accept credits
from.